function JM_distance = cal_JM_distance(array1,array2)
    %%%%%%%%%%%%%%%
    mean_array1 = mean(array1);
    mean_array2 = mean(array2);
    std_array1 = std(array1);
    std_array2 = std(array2);
    if std_array1 ~= 0 && std_array2 ~= 0
        var_array1 = std_array1*std_array1;
        var_array2 = std_array2*std_array2;
        var_plus = var_array1+var_array2;
        B = 0.25*(mean_array1-mean_array2)^2/var_plus + 0.5*(log(var_plus/(2*std_array1*std_array2)));
        JM_distance = 2*(1-exp(-B));
    elseif std_array2 ~= 0
        var_array2 = std_array2*std_array2;
        B = 0.25*(mean_array1-mean_array2)^2/var_array2;
        JM_distance = 2*(1-exp(-B)*sqrt(2/std_array2));
    else

        JM_distance = 2*(1-exp(-abs(mean_array1 - mean_array2)));
    end
end